package com.egg.auth.service.user;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.egg.auth.entity.user.User;
import com.egg.auth.model.request.web.UserPut;
import com.egg.auth.model.response.web.UserInfo;
import com.egg.auth.model.response.web.UserPage;
import com.egg.common.mybatis.service.IBaseService;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Optional;


/**
 * @author east
 */
public interface IUserService extends IBaseService<User> {


    void put(Serializable id, UserPut userPut);

    void delUser(Collection<? extends Serializable> userIds);

    Optional<User> findByPhone(String phone);

    Page<User> page(
            Integer current, Integer pageSize
            , Optional<String> state
            , Optional<Boolean> online
            , Optional<String> search
            , Optional<Serializable> deptId
    );

    Page<User> page(
            Integer current, Integer pageSize
            , Optional<Collection<? extends Serializable>> ids
            , Optional<String> realName
            , Optional<String> nickname
            , Optional<String> phone
            , Optional<String> state
            , Optional<String> gender
            , Optional<Boolean> online
            , Optional<String> search
            , Optional<Serializable> deptId
    );

    List<UserPage> convertUserPage(List<User> sourceUserList);

    /**
     * 更新用户在线状态
     *
     * @param userId
     */
    void resetOnline(Serializable userId);

    /**
     * 更新用户离线状态
     *
     * @param userId
     */
    void resetOffline(Long userId);

    UserInfo buildUserInfoByUserId(Serializable userId);


}
